<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title">上传标签</h4>
</div>
<form id="labels-form" action="/xqc/overseas-in/os-trace" method="post" enctype="multipart/form-data">
    <div class="modal-body">
        <div class="row">
            <div class="form-group" style="padding-bottom: 30px;">
                <label for="labels_name" style="padding-top: 8px;text-align: right;" class="col-sm-3 control-label">标签名称</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control" id="labels_name" name="param[labels_name]" placeholder="标签名称" required>
                </div>
            </div>
            <div class="form-group" style="padding-bottom: 30px;">
                <label style="padding-top: 8px;text-align: right;" class="col-sm-3 control-label">标签文件</label>
                <div class="col-sm-8">
                    <input type="file" style="margin-top: 5px;" name="source_file" required>
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer">
        {{ csrf_field() }}
        <input type="hidden" name="param[id]" value="{{ $id }}">
        <input type="hidden" name="action" value="doUploadLabels">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <button type="submit" class="btn btn-primary">提交</button>
    </div>
</form>
<script language="JavaScript" type="text/javascript">
    $(function () {
        $("#labels-form").ajaxForm(function (data) {
            if (typeof data === 'object') {
                if (data.status) {
                    $("#listModal").modal('hide');
                    $(".modal-backdrop").remove();
                    $('body').removeClass('modal-open');
                    toastr.success('提交成功 !');
                    $.pjax.reload('#pjax-container');
                } else {
                    swal(data.message, '', 'error');
                }
            }
        });
    });
</script>
